package com.ybg.bookrules.module.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("userinfos")
public class Userinfos {
    @TableId(type = IdType.AUTO)
    private Integer userid;
    private int roleid;
    private String username;
    private String password;
    private String realname;
    private int gender;
    private String cardid;
    private String telephone;
    private String address;
    private Date registertime;
    @TableLogic
    private int deleted;

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return userid +
                ","+ roleid +
                "," + username +
                "," + realname +
                "," + gender +
                "," + cardid +
                "," + telephone +
                "," + address+
                "," + sdf.format(registertime)
              ;
    }
}
